Skip to content

Conversation

idg10
Copy link
Collaborator

@idg10 idg10 commented Oct 6, 2025

This removes WPF and Windows Forms support from the publicly visible API of System.Reactive, moving it into new System.Reactive.For.Wpf and System.Reactive.For.WindowsForms packages. (This only removes them from the compile-time API. These APIs are gone from the ref assemblies, but remain in the lib ones to ensure binary compatibility.)

This resolves #1745

The 'great unification' of Rx 4.0, in which all Rx.NET features were merged into a single NuGet package, has had unfortunate consequences in the long run. In particular, the decision to include UI-framework-specific code in this unification has meant that any application with a Windows-specific TFM for Windows 10.0.19041 or later will, if it uses System.Reactive end up with dependencies on both Windows Forms and WPF. The effect of this is that for certain styles of deployment (AoT or self-contained), the build output includes a copy of these UI frameworks. These are tens of megabytes in size, and for applications that are not actually using either WPF or Windows Forms, this is a significant penalty.

As long as System.Reactive's public API includes types that belong to either of these frameworks, it is not possible to remove the transient framework dependency that System.Reactive imposes on applications that use it. That is why we are effectively removing these features from the publicly visible API. (Removing them entirely would break backwards compatibility. In cases where an application developer uses other components that use Rx, they might not be able to resolve the problems this would cause. This is why we retain the 'removed' API features in the runtime API available in the NuGet package's lib folder.)

idg10 added 30 commits February 12, 2024 18:28
Deprecate all UI-framework-specific and platform-specific types in System.Reactive. Add various System.Reactive.Integration.... packages with the replacement types.
It looks like a few tests that fetched DispatcherScheduler.Current used to rely on the Dispatcher already having been created. Up until recently, that was true by random chance. But recent changes, which presumably have affected the order of test execution, mean that's no longer true.

These tests should always have ensured a dispatcher was available before starting to run, and now they do.
* Add Obsolete attributes
* Add the newly-public (was internal) member of AsyncLock
Change SDK file ref to a version available on the build agent
Replace net6.0 with net8.0
Remove uap10.0.18362 from non-legacy components
Use .NET SDK PackageValidation for System.Reactive API compatibility check. Initial ADR drafts
Use Microsoft.CodeAnalysis.PublicApiAnalyzers in System.Reactive.Net
Remove the ApiApprovalTests that are now superceded by the use of package validation for the legacy System.Reactive package, and public API analyzers for the new System.Reactive.Net.
Before, the build system didn't know we are using a custom ref assembly. This meant, amongst other things, that tests no longer built.
This was after all the entire point of this branch.
These crept in from a merge.
@idg10 idg10 added this to the Rx 7.0 milestone Oct 6, 2025
@idg10 idg10 self-assigned this Oct 6, 2025
@idg10 idg10 added the [area] Rx label Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding System.Reactive to WinUI3/MAUI app increases package size by 44MB because it includes WPF and WinForms references
1 participant